From f8bac2ece2a62611343d5d5e76149435a7540aaf Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Thu, 6 Apr 2006 20:54:33 +0000 Subject: [PATCH] fix rounding error + atan(0,0) instability git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1834 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/garmin_txt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gpsbabel/garmin_txt.c b/gpsbabel/garmin_txt.c index 1be486c64..b6b19fb9e 100644 --- a/gpsbabel/garmin_txt.c +++ b/gpsbabel/garmin_txt.c @@ -296,6 +296,7 @@ course_rad(double lat1, double lon1, double lat2, double lon2) v1 = sin(lon1 - lon2) * cos(lat2); v2 = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1 - lon2); if (fabs(v2) < 0.000000000000001) v2 = 0.0; /* fix calculation diff. between 32- and 64-bit systems */ + if (fabs(v1) < 0.000000000000001) v1 = 0.0; /* fix calculation diff. between 32- and 64-bit systems */ return atan2(v1, v2); } -- 2.30.2